import { EnumSchema } from '@/utils/common/types';
import { PresetColorEnum } from '@/enums/colorEnum';

//#region 品牌空间资讯类型
export enum SpaceTypeEnum {
  Highlight = 0,
  Philanthropy,
  ExcellentCase,
}

export class SpaceTypeEntity {
  Type: SpaceTypeEnum;
  /** 显示描述 */
  Display: string;
  /** 颜色 */
  Color?: PresetColorEnum | string;

  constructor(spaceType: SpaceTypeEnum, color?: PresetColorEnum | string) {
    this.Type = spaceType;
    this.Color = color;
    switch (spaceType) {
      case SpaceTypeEnum.Highlight:
        this.Display = '高光时刻';
        this.Color = this.Color ? this.Color : PresetColorEnum.Green;
        break;
      case SpaceTypeEnum.Philanthropy:
        this.Display = '公益之星';
        this.Color = this.Color ? this.Color : PresetColorEnum.Blue;
        break;
      case SpaceTypeEnum.ExcellentCase:
        this.Display = '精彩案列';
        this.Color = this.Color ? this.Color : PresetColorEnum.Blue;
        break;
    }
  }
}

export function getSpaceTypeEnumSchema(enableTag = true): EnumSchema[] {
  const enumSchema: EnumSchema[] = [];
  const typeEntities: SpaceTypeEntity[] = [
    new SpaceTypeEntity(SpaceTypeEnum.Highlight),
    new SpaceTypeEntity(SpaceTypeEnum.Philanthropy),
    new SpaceTypeEntity(SpaceTypeEnum.ExcellentCase),
  ];
  typeEntities.forEach((item) => {
    enumSchema.push({
      key: item.Type as number,
      label: item.Display,
      value: item.Type as number,
      tag: enableTag,
      tagColor: item.Color,
    });
  });
  return enumSchema;
}
//#endregion
